<?php
/**
 * Contains a set of mapping rules
 *
 * @author Tony
 */
class Rules {
  private $rules = array();
  
  function __construct($map_file_name) {  
    $map_file = fopen($map_file_name, "r");
    $this->parse($map_file);
    fclose($map_file);
  }
  
  private function parse($map_file) {
    while(!feof($map_file)){
      $line = fgets($map_file);
      $from = strtok($line, "->");
      $to = strtok("->");
      $rule = new Rule($from, $to);
      array_push($this->rules, $rule);
    }
  }
  
  public function getRules() {
    return $this->rules;
  }
  
}

class Rule {
  public $from;
  public $to;
  function __construct($from, $to) {
    $this->from = trim($from);
    $this->to = trim($to);
  }
}
?>
